<link type="text/css" rel="stylesheet" href="themes/${theme}/main_old.css" />
<script type='text/javascript' src='js/jquery.js'></script>
<script type='text/javascript' src='js/jquery.progressbar.min.js'></script>
<script type='text/javascript' src='js/utils.js.php'></script>
<script type='text/javascript' src='js/thickbox.js.php'></script>
<script type='text/javascript' src='js/jquery.validate.js'></script>
<script>
	$(document).ready(function(){
		$("#project").change(function(){
			$("#sprint").disabled = true;
			$.ajax ({
				type: "GET",
				url: "services/sprint_list.php",
				data: "project=" + $(this).val(),
				dataType: "html",
				success:function(html){
					$("#sprint").html(html);
					$("#sprint").disabled = false;
				}
			});
		});

		$("#new_story").click(function() {
			
		})
	});


function show(id){
	if(document.getElementById(id).style.display == 'none'){
		document.getElementById(id).style.display = '';
	}else{
		document.getElementById(id).style.display = 'none';
	}
}
</script>
<table width="99%" border="0" cellpadding="0" cellspacing="0" class="sprint_toolbar" align="center">
<tr>
	<td height="30">
	<table width="99%" border="0" cellpadding="1" cellspacing="1" align="center">
	<tr>
	<td>
		<?=_("project")?>:
		<select name="project" id="project" class="sprint_project_select">

		</select>
		<?=_("Sprint")?>:
		<select name="sprint" id="sprint" class="sprint_select">

		</select>
		<input type="submit" value="<?=_("Load")?>" class="bt"/>
	</td>
	<td></td>
	<td align="right" width="60">
		<div id="new_sprint" name="new_sprint">
		<a href="sprint_add.php?project=<?=$project?>" class="thickbox">
		<input type="button" class="bt" value="New Sprint" />
		</a>
		</div>
	</td>
	<td align="right" width="60">
		<div id="new_sprint" name="new_sprint">
		<a href="story_add.php?sprint=<?=$sprint?>&project=<?=$project?>" class="thickbox">
		<input type="button" class="bt" Value="New Story" />
		</a>
		</div>
	</td>
	</tr>
	</table>
	</td>
	</tr>
</table>
<bri />

<? /**** Stories  ****/ ?>
<table width="99%" height="82%" border="0" cellpadding="0" cellspacing="0" align="center">
<tr>
<td width="50%" height="50%" class="window_stories">
<table width="100%" height="100%" border="0" cellpadding="1" cellspacing="2">
<tr>
<td width="50%" height="20" class="board_title"><?=_("Not planned") ?></td>
<td class="board_title"><?=_("Next") ?></td>
</tr>
<tr>
<td valign="top">
<?
$stories = sprint_get_stories($sprint,$project, 'NOT PLANNED');
if (is_array($stories)) {
	foreach ($stories AS $key => $story) {
		if ($story['closed'] == 1) {
			$class = "story_done";
		} else {
			$class = "story_pennding";
		}
		$user = $story['lastname']." ".$story['name'];
		echo html_story($story['priority'],$story['estimated'],$story['summary'],$story['description'],$user,$class, $story['id_sbacklog']);
	}
}
?>
</td>
<td valign="top" class="board_status_separator">
<?
$stories = sprint_get_stories($sprint,$project, 'NEXT');
if (is_array($stories)) {
	foreach ($stories AS $key => $story) {
		$class = "story_pennding";
		$user = $story['lastname']." ".$story['name'];
		echo html_story($story['priority'],$story['estimated'],$story['summary'],$story['description'],$user,$class, $story['id_sbacklog']);
	}
} else {
	echo _("No user stories registred");
}
?>
</td>
</tr>
</table>
</td>
<td>
<? /******** G R A F I C  ********/ ?>

</td>
</tr>
<tr>
<td height="20"></td>
</tr>
<tr>
<td colspan="2" class="window_stories" align="center">
<table width="100%" height="100%"  border="0" cellpadding="1" cellspacing="2">
<tr>
<td height="20" width="25%" class="board_title">TODO</td>
<td width="25%" class="board_title">Process</td>
<td width="25%" class="board_title">Test</td>
<td width="25%" class="board_title">Done!</td>
</tr>
<tr>
<td valign="top">
<?
$stories = sprint_get_stories($sprint,$project, 'TODO');
if (is_array($stories)) {
	foreach ($stories AS $key => $story) {
		$class = "story_pennding";
		$user = $story['lastname']." ".$story['name'];
		echo html_story($story['priority'],$story['estimated'],$story['summary'],$story['description'],$user,$class, $story['id_sbacklog']);
	}
} else {
	echo _("No user stories registred");	
}
?>
</td>
<td valign="top" class="board_status_separator">
<?
$stories = sprint_get_stories($sprint,$project, 'PROCESS');
if (is_array($stories)) {
	foreach ($stories AS $key => $story) {
		$class = "story_pennding";
		$user = $story['lastname']." ".$story['name'];
		echo html_story($story['priority'],$story['estimated'],$story['summary'],$story['description'],$user,$class, $story['id_sbacklog']);
	}
} else {
	echo _("No user stories registred");
}
?>
</td>
<td valign="top" class="board_status_separator">
<?
$stories = sprint_get_stories($sprint,$project, 'TEST');
if (is_array($stories)) {
	foreach ($stories AS $key => $story) {
		$class = "story_pennding";
		$user = $story['lastname']." ".$story['name'];
		echo html_story($story['priority'],$story['estimated'],$story['summary'],$story['description'],$user,$class, $story['id_sbacklog']);
	}
} else {
	echo _("No user stories registred");
}
?>
</td>
<td valign="top" class="board_status_separator">
<?
$stories = sprint_get_stories($sprint,$project, 'DONE');
if (is_array($stories)) {
	foreach ($stories AS $key => $story) {
		$class = "story_done";
		$user = $story['lastname']." ".$story['name'];
		echo html_story($story['priority'],$story['estimated'],$story['summary'],$story['description'],$user,$class, $story['id_sbacklog']);
	}
} else {
	echo _("No user stories registred");
}
?>
</td>
</tr>
</table>
</td>
</tr>
</table>
